Index

api/v1/cardfiles/{cardno}/contacts

Path: api/v1/cardfiles/{cardno}/contacts

This API is JSON:API compliant.

This endpoint supports the following methods:
GET POST PATCH DELETE

The resource type for this endpoint is CardFileContact
The identifier is cardno-contno

The CardFileContact resource type attributes are as follows:

{
"contNo":integer (read-only)
"title":string
"firstName":string
"middleName":string
"lastName":string
"displayName":string
"jobTitle":string
"department":string
"dob":string
"isPrimary":boolean (read-only)
"details": [{
"type":string
"value":string
"comments":string
}]
"webAccount":{
Flag to indicate if the web logon is enabled. If omitted on creates the account will be enabled.
optional
"enabled":boolean
The logon id for the contact must be unique.
"logonId":string
If not provided Jim2 will automatically generate a password for the contact.
optional
"password":string Note: Will not be returned in the response if value is null.
}
}

Example GET (Return all)

Path: api/v1/cardfiles/10/contacts

Response:

{
    "data": [
        {
            "id": "10-1",
            "type": "CardFileContact",
            "attributes": {
                "contNo": 1,
                "title": "Mr",
                "firstName": "Contact",
                "middleName": "",
                "lastName": "One",
                "displayName": "Contact One",
                "jobTitle": "",
                "department": "",
                "dob": null,
                "isPrimary": true,
                "details": [
                    {
                        "type": "Phone",
                        "value": "0413 000 000",
                        "comments": ""
                    }
                ],
                "webAccount": null
            }
        },
        {
            "id": "10-2",
            "type": "CardFileContact",
            "attributes": {
                "contNo": 2,
                "title": "Mrs",
                "firstName": "Contact",
                "middleName": "",
                "lastName": "Two",
                "displayName": "Contact Two",
                "jobTitle": "",
                "department": "",
                "dob": null,
                "isPrimary": false,
                "details": [
                    {
                        "type": "Phone",
                        "value": "",
                        "comments": ""
                    }
                ],
                "webAccount": null
            }
        }
    ]
}

Example GET (Return specific)

Path: api/v1/cardfiles/10/contacts/10-1

Response:

{
    "data": {
        "id": "10-1",
        "type": "CardFileContact",
        "attributes": {
            "contNo": 1,
            "title": "Mr",
            "firstName": "Contact",
            "middleName": "",
            "lastName": "One",
            "displayName": "Contact One",
            "jobTitle": "",
            "department": "",
            "dob": null,
            "isPrimary": true,
            "details": [
                {
                    "type": "Phone",
                    "value": "0413 000 000",
                    "comments": ""
                }
            ],
            "webAccount": null
        },
        "links": {
            "self": "/api/v1/cardfiles/10/contacts/10-1"
        }
    }
}

Example POST

Path: api/v1/cardfiles/contacts

Request:

{
    "data": {
        "type": "CardFileContact",
        "attributes": {
            "title": "Dr",
            "firstName": "Contact",
            "lastName": "Three",
            "displayName": "Contact Three",
            "details": [
                {
                    "type": "EMail",
                    "value": "Contact3@test.com"
                }
            ],
            "webAccount": {
                "logonId": "Contact3@test.com"
            }
        }
    }
}

Response:

{
    "data": {
        "id": "10-3",
        "type": "CardFileContact",
        "attributes": {
            "contNo": 3,
            "title": "Dr",
            "firstName": "Contact",
            "middleName": null,
            "lastName": "Three",
            "displayName": "Contact Three",
            "jobTitle": null,
            "department": null,
            "dob": null,
            "isPrimary": false,
            "details": [
                {
                    "type": "EMail",
                    "value": "Contact3@test.com",
                    "comments": null
                }
            ],
            "webAccount": {
                "enabled": null,
                "logonId": "Contact3@test.com"
            }
        },
        "links": {
            "self": "/api/v1/cardfiles/10/contacts/10-3"
        }
    }
}

Example PATCH

Path: api/v1/cardfiles/10/contacts/10-1

Request:

{
    "data": {
        "id": "10-1",
        "type": "CardFileContact",
        "attributes": {
            "details": [
                {
                    "type": "EMail",
                    "value": "stevesyyy@jim2",
                    "comments": ""
                }
            ],
            "webAccount": {
                "logonId": "stevesyyy@jim2"
            }
        }
    }
}

Response:

{
    "data": {
        "id": "10-1",
        "type": "CardFileContact",
        "attributes": {
            "contNo": 1,
            "title": "Mr",
            "firstName": "Contact",
            "middleName": "",
            "lastName": "One",
            "displayName": "Contact One",
            "jobTitle": "",
            "department": "",
            "dob": null,
            "isPrimary": false,
            "details": [
                {
                    "type": "Phone",
                    "value": "",
                    "comments": ""
                },
                {
                    "type": "EMail",
                    "value": "stevesyyy@jim2",
                    "comments": ""
                }
            ],
            "webAccount": {
                "enabled": null,
                "logonId": "stevesyyy@jim2"
            }
        },
        "links": {
            "self": "/api/v1/cardfiles/10/contacts/10-1"
        }
    }
}